import request from '@/utils/request'

// *登录
export const loginAPI = (data: object) =>
  request({ url: '/sys/login', method: 'post', data })

// *获取用户基本信息
export const getUserInfoAPI = () =>
  request({ url: '/sys/profile', method: 'post' })

// *获取员工基本信息
export const getUserInfoByIdAPI = (id: string) =>
  request({ url: `/sys/user/${id}` })
// *保存员工基本信息
export const updateUserInfoAPI = (id: string, data: object) =>
  request({ url: `/sys/user/${id}`, method: 'put', data })

// *给员工分配权限角色
interface IAssignRole {
  id: string
  roleIds: string[]
}
export const assignUserRoleAPI = (data: IAssignRole) =>
  request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
